import { defineStore } from "pinia";
import {
  LowCodeAst,
  LowCodePage,
  StoreLowCodeState,
  ElementPlusList,
} from "@src/config/interface";
export const lowCodeStore = defineStore("lowCode", {
  state(): StoreLowCodeState {
    return {
      page: {
        width: "375",
        height: "667",
      },
      lowCode: [],
      ElementPlusList: [],
      propertiesVisible: false,
    };
  },
  getters: {
    getPageBounding(): LowCodePage {
      return this.page;
    },
    getLowCodeComponents(): LowCodeAst[] {
      return this.lowCode;
    },
    getElementPlusList(): ElementPlusList {
      return this.ElementPlusList;
    },
    getPropertiesVisible(): boolean {
      return this.propertiesVisible;
    },
  },
  actions: {
    setPageBounding(page: LowCodePage) {
      this.page = page;
    },
    setLowCode(lowCode: LowCodeAst[]) {
      this.lowCode = lowCode;
    },
    setPropertiesVisible(propertiesVisible: boolean) {
      this.propertiesVisible = propertiesVisible;
    },
  },
});
